﻿@model order_dto
@{
    ViewBag.Title = "订单详情";
    Layout = "~/Views/Shared/_MallLayout.cshtml";
    var img_url = ViewBag.img_url;
}
<body class="page-cartConfirm page-order page-MyorderView">
    <div class="wait">
        <div class="states">
            <div class="fn-clear">
                <i class="icon-state1 fn-left"></i>
                @if (Model.status == OrderStatus.WaitPay) {
                    <span class="fn36 fn-left">
                        待支付
                    </span>
                } else if (Model.status == OrderStatus.WaitDelivery) {
                    <span class="fn36 fn-left">
                        待发货
                    </span>
                } else if (Model.status == OrderStatus.Confirm) {
                    <span class="fn36 fn-left">
                        待收货
                    </span>
                } else if (Model.status == OrderStatus.Finish) {
                    <span class="fn36 fn-left">
                        已完成
                    </span>
                } else if (Model.status == OrderStatus.Close) {
                    <span class="fn36 fn-left">
                        已关闭
                    </span>
                } else if (Model.status == OrderStatus.Delete) {
                    <span class="fn36 fn-left">
                        已删除
                    </span>
                }
                @if (Model.status == OrderStatus.Confirm) {
                    if (Model.shipping.shipping_time != null
                        && ((DateTime)Model.shipping.shipping_time).AddDays(5) < DateTime.Now
                        && ((DateTime)Model.shipping.shipping_time).AddDays(12) > DateTime.Now) {
                        <span class="fn-right fn26 count_down">
                            <em class="day_num"></em><em class="hour_num"></em><em class="min_num"></em><em class="sec_num"></em>
                            后自动收货
                        </span>
                    }
                }
            </div>

        </div>
        <div class="mod-orderDetail bg-white relative mb10">
            <div class="orderAddress absolute">
                <div class="box">
                    <i class="icon-loca"></i>
                    <div class="top fn30 mb20">
                        <span class="name">@(StringHelper.StringDesensitization(Model.shipping.ship_to))</span>&nbsp;
                        @(StringHelper.StringDesensitization(Model.shipping.phone))
                    </div>
                    <p class="col-gray fn26 inAddress">  @(StringHelper.StringDesensitization(Model.shipping.region_name + Model.shipping.address))</p>
                </div>
            </div>
            <div class="kong"></div>
            <ul>
                <li>
                    @foreach (var item in Model.order_items) {
                        <div class="innerItem innerItemWhite">
                            <div class="img">
                                @if (item.order_item_type != 6) {
                                    <img src="@(item.product.main_image_url != null ? item.product.main_image_url : img_url + item.product.first_image)" />
                                } else {
                                    <img src="@(img_url +item.bazaar_product.main_img)" />
                                }
                            </div>
                            <div class="text">
                                <p class="fn28 col-gray1 tit mb15">
                                    @if (item.order_item_type != 6) {@item.product.name} else {@item.bazaar_product.product_name}
                                </p>
                                <div class="col-gray mb10">
                                    <span class="mr20">@item.sku_name</span>
                                    @*<span class="">XL</span>*@
                                </div>
                                <div class="price">
                                    @if (item.unit_price > 0) {
                                        <em class="fn22">￥</em>
                                        <span class="fn28 itemPrice">@item.unit_price.ToString("0.##")</span>
                                    }
                                    @if (item.unit_price > 0 && item.red_drill > 0) {
                                        <em class="fn22">+</em>
                                    }
                                    @if (item.red_drill > 0) {
                                        <span class="fn28 itemPrice">@item.red_drill.ToString("0.######")</span>
                                        <em class="fn22">红钻</em>
                                    }
                                    <span class="fn-right quantity">
                                        <em class="col-gray">×</em> <em class="j-quantity">@item.quantity</em>
                                    </span>
                                </div>
                            </div>
                        </div>
                    }

                    <div class="block">
                        <span class="fn-right fn26">
                            <em class="mr20">共@(Model.order_items.Sum(o => o.quantity))件商品</em>
                            <em>支付金额：</em>
                            @if (Model.pay_amount > 0) {
                                <em class="fn24">￥</em>
                                <em class="fn30">@(Model.pay_amount.ToString("0.##"))</em>
                            }
                            @if (Model.pay_amount > 0 && Model.red_drill > 0) {
                                <em class="fn24">+</em>
                            }
                            @if (Model.red_drill > 0) {
                                <em class="fn30">@(Model.red_drill.ToString("0.######"))</em>
                                <em class="fn24">红钻</em>
                            }
                        </span>
                    </div>
                    
                    <div class="block fn-center borderTop mt30">
                        @*<i class="icon-phone2 mr10"></i>
            <span class="fn28 contract">联系商家</span>*@
                    </div>
                </li>
            </ul>
        </div>
    </div>
    <div class="lt-block col-gray fn28">
        @if (Model.status == OrderStatus.WaitDelivery || Model.status == OrderStatus.Confirm || Model.status == OrderStatus.Finish) {

            <p>
                订 单 号：
                @Model.order_no
            </p>
            <p>
                支付单号：@Model.pay_info.pay_no
            </p>
            <p>
                创建时间：@(Model.order_time == null ? "" : Model.order_time.ToString("yyyy-MM-dd HH:mm:ss"))
            </p>
            <p>
                支付时间：@(Model.pay_info.create_time == null ? "" : Model.pay_info.create_time.ToString("yyyy-MM-dd HH:mm:ss"))
            </p>
            <p>
                @if (Model.status == OrderStatus.Confirm) {
                    <text>  发货时间： @(Model.shipping.shipping_time == null ? "" : ((DateTime)Model.shipping.shipping_time).ToString("yyyy-MM-dd HH:mm:ss"))</text>
                }
                @if (Model.status == OrderStatus.Finish) {
                    <text>成交时间： @(Model.finish_time == null ? "" : ((DateTime)Model.finish_time).ToString("yyyy-MM-dd HH:mm:ss"))</text>
                }
            </p>


        }

    </div>
    <script src="~/Scripts/tokenmall/countDown.js"></script>
    <script language="javascript" type="text/javascript">

        $(function () {
            $(".count_down").countDown({
                startTimeStr: "@(Model.shipping.shipping_time ?? DateTime.Now)",//开始时间
                endTimeStr: " @((Model.shipping.shipping_time ?? DateTime.Now.AddDays(-12)).AddDays(12))",//结束时间
                daySelector: ".day_num",
                hourSelector: ".hour_num",
                minSelector: ".min_num",
                secSelector: ".sec_num"
            });
        });


        $('.contract').click(function () {
            location.href = "tel:@ViewBag.ServicePhone";
        });
    </script>
</body>
